//
//  Labs_UIButtonTouch_DemoVC.swift
//  APSwift
//
//  Created by jianbo.pei on 2022/4/19.
//

import UIKit

class Labs_UIButtonTouch_DemoVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        test()
    }
    

    private func test() {
        let bt = UIButton(type: .custom)
        view.addSubview(bt)
        bt.setTitle("点击一下吧", for: .normal)
        bt.backgroundColor = .gray
        bt.frame = CGRect(x: 100, y: 200, width: 200, height: 50)
        bt.addTarget(self, action: #selector(tapedDown), for: .touchDown)
        bt.addTarget(self, action: #selector(tapedUpInside), for: [.touchUpInside])
    }
    
    @objc private func tapedDown() {
        print("tapedDown")
    }
    
    @objc private func tapedUpInside() {
        print("tapedUpInside")

    }

}
